@echo on

if NOT "%1"=="" (
	if NOT "%2"=="" GOTO :ARGSOK
)

:ERROR
echo "usage: CompleteBuild <Target (clean, build)> <Release|Debug> "
GOTO :EOF

:ARGSOK

cls

set FLAVOR=%2
set TARGET=%1
set VERBOSITY=m

cd ..\..

goto :buildsolution

cd %SPOCLIENT%
Msbuild Build.dirproj /T:build /p:flavor=%FLAVOR%

cd %SPOCLIENT%\Solutions\HAG\DeviceCode\HAG_IOBUS\targets\dotnetmf\api\IOBus
msbuild IOBus.sln /t:%TARGET% /p:Configuration=%FLAVOR% /v:%VERBOSITY%

cd %SPOCLIENT%\Solutions\HAG\DeviceCode\HAG_IOBUS\targets\dotnetmf\api\IOBusClasses
msbuild IOBusClasses.sln /t:%TARGET% /p:Configuration=%FLAVOR% /v:%VERBOSITY%

cd %SPOCLIENT%\solutions\HAG\ManagedCode
msbuild build.dirproj /t:%TARGET% /p:memory=RAM;flavor=%FLAVOR%;HAG_CFG=HAG32 /v:%VERBOSITY%

:buildsolution

cd %SPOCLIENT%\solutions\HAG
msbuild dotnetmf.proj /t:%TARGET% /p:memory=RAM;flavor=%FLAVOR%;HAG_CFG=HAG32 /v:%VERBOSITY%

:EOF
cd %SPOCLIENT%\Solutions\HAG
echo done.